package bar.dark.lee.fan;

import bar.dark.lee.R;
import bar.dark.lee.SuperTabActivity;
import bar.dark.lee.common.BDUtil;
import bar.dark.lee.insert.InsertInActivity;
import bar.dark.lee.insert.InsertOutActivity;
import bar.dark.lee.setting.TipInfoActivity;
import bar.dark.lee.setting.TipsActivity;
import android.app.LocalActivityManager;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.LinearLayout.LayoutParams;

public class FanTabActivity extends SuperTabActivity
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.tab_activity);
		setTitle("부채");
		
		TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
		
		LocalActivityManager manager = getLocalActivityManager();
		tabHost.setup(manager);
		
		Intent intent1 = new Intent(this, FanOutActivity.class);
		
		Intent intent2 = new Intent(this, FanInActivity.class);
		
		LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
				0, LayoutParams.FILL_PARENT);
		params.weight = 1;
		
		tabHost.addTab(tabHost.newTabSpec("빌려준금액")
				.setIndicator(BDUtil.getTextView(this, "빌려준금액"))
				.setContent(intent1));
		tabHost.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.btn_set_tab);
		tabHost.getTabWidget().getChildAt(0).setLayoutParams(params);
		
		tabHost.addTab(tabHost.newTabSpec("빌린금액")
				.setIndicator(BDUtil.getTextView(this, "빌린금액"))
				.setContent(intent2));
		tabHost.getTabWidget().getChildAt(1).setBackgroundResource(R.drawable.btn_set_tab);
		tabHost.getTabWidget().getChildAt(1).setLayoutParams(params);
		
		tabHost.addTab(tabHost.newTabSpec("")
				.setIndicator(new LinearLayout(this))
				.setContent(new Intent()));
		tabHost.getTabWidget().getChildAt(2).setVisibility(View.GONE);
		tabHost.getTabWidget().getChildAt(2).setLayoutParams(params);
	}

	@Override
	protected void tipButton()
	{
		Intent intent = new Intent(this, TipInfoActivity.class);
		intent.putExtra(TipsActivity.TIP_REQUEST_KEY, TipsActivity.TIP_FAN);
		startActivity(intent);
	}
}
